/**
 *
 */
package com.honeybees.framework.datatables.ajax;

import java.io.Serializable;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * <dl>
 * <dt><b> 列 </b></dt>
 * <p>
 * <dd>https://datatables.net/reference/api/column().search()</dd>
 * <dd>https://datatables.net/reference/api/columns().search()</dd>
 * <dd>
 * <p>
 * columns[0][data]:id <br>
 * columns[0][name]: <br>
 * columns[0][searchable]:true <br>
 * columns[0][orderable]:false <br>
 * columns[0][search][value]: <br>
 * columns[0][search][regex]:false <br>
 * columns[1][data]:processInstanceId <br>
 * columns[1][name]: <br>
 * columns[1][searchable]:true <br>
 * columns[1][orderable]:false <br>
 * columns[1][search][value]: <br>
 * columns[1][search][regex]:false <br>
 * ...
 * </dd>
 * </dl>
 * <p>
 * Copyright (C) All rights reserved.
 * </p>
 *
 * @author 李远明
 * @since 2017-03-31 11:13:45
 */
public class Column implements Serializable {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = -1464717971679494058L;
    /**
     * defined by  columns.data 解析回调数据时使用
     */
    private String data;
    /**
     * defined by columns.name 排序的字段名称使用这个
     */
    private String name;
    /**
     * 指定该列是否支持搜索
     */
    private boolean searchable;
    /**
     * 指定该列是否支持排序
     */
    private boolean orderable;
    /**
     * 针对指定列的搜索
     * <p>
     * columns[i].search.value：针对指定列的搜索值<br>
     * columns[i].search.regex：标识该列是否被当做常规表达式
     * </p>
     */
    private Search search;

    public Column() {
        this.search = new Search();
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isSearchable() {
        return searchable;
    }

    public void setSearchable(boolean searchable) {
        this.searchable = searchable;
    }

    public boolean isOrderable() {
        return orderable;
    }

    public void setOrderable(boolean orderable) {
        this.orderable = orderable;
    }

    public Search getSearch() {
        return search;
    }

    public void setSearch(Search search) {
        this.search = search;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }

}
